﻿//
// IScorBotScript.cs
//
// Authors:
//    Claus Jørgensen <10229@iha.dk>
//    Lars Rønde Hansen <09548@iha.dk>
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics.Contracts;

namespace RSD.Scripting
{
    /// <summary>
    /// Scripting-engine interface to be used with <see cref="IRobotController"/>.
    /// </summary>
    [ContractClass(typeof(Contracts.IScorBotScriptContract))]
    public interface IScorBotScript : IScorBotScriptAsync
    {
        /// <summary>
        /// Event for every time a action is executed.
        /// </summary>
        event EventHandler<ActionExecutedEventArgs> ActionExecuted;

        /// <summary>
        /// Occurs when a item is added to the inventory.
        /// </summary>
        event EventHandler<ItemAddedEventArgs> ItemAdded;

        /// <summary>
        /// Gets a value indicating whether the scripting-engine is executing.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if the scripting-engine is executing; otherwise, <c>false</c>.
        /// </value>
        bool IsExecuting
        {
            get;
        }

        /// <summary>
        /// Executes the script.
        /// </summary>
        /// <param name="script">The script to execute.</param>
        void ExecuteScript(string script);

        /// <summary>
        /// Executes the script.
        /// </summary>
        /// <param name="reader">TextReader for loading entire files or streams.</param>
        void ExecuteScript(TextReader reader);

        /// <summary>
        /// Checks syntax in script.
        /// </summary>
        /// <param name="reader">The script to execute.</param>
        void CheckScript(string script);

        /// <summary>
        /// Checks syntax in script.
        /// </summary>
        /// <param name="reader">TextReader for loading entire files or streams.</param>
        void CheckScript(TextReader reader);
    }
}
